import 'package:flustars/flustars.dart';
import 'package:flutter_ncsjqz_getx/constant/keys.dart';
import 'package:flutter_ncsjqz_getx/generated/json/base/json_convert_content.dart';
import 'package:flutter_ncsjqz_getx/model/login_entity.dart';


/// desc: 获取本地用户信息
LoginData getUserUtil(){
  var map = SpUtil.getObject(Keys.userDataInfo);
  if(map == null)  return LoginData();
  LoginData loginData = JsonConvert.fromJsonAsT<LoginData>(map) ?? LoginData();
  return loginData;
}

/// desc: 存储本地用户信息
Future<bool?> setUserUtil(Object value) async{
  if(value  == '') return false;
  return await SpUtil.putObject (Keys.userDataInfo,value);
}

/// desc: 删除本地用户信息
Future<bool?> delUserUtil() async{
  return await SpUtil.remove (Keys.userDataInfo,);
}